package com.ruoyi.web.controller.report;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.report.vo.StudentRegisterBody;
import com.ruoyi.system.service.report.IStudentRegisterService;
import com.ruoyi.system.service.report.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/student")
@CrossOrigin
public class StudentRegisterController extends BaseController {

    @Autowired
    private IStudentRegisterService registerService;

    @Autowired
    private IStudentService iStudentService;


    @PostMapping("/register")
    public AjaxResult register(@RequestBody StudentRegisterBody studentRegisterBody) {
        String msg = registerService.register(studentRegisterBody);
        return StringUtils.isEmpty(msg) ? success() : error(msg);
    }

    /**
     * 选择班级
     * @return
     */
    @GetMapping("/classSelect")
    public AjaxResult classSelect() {
        return AjaxResult.success(iStudentService.classSelect());
    }
}
